[Music] Welcome to Your First Express Web Application. After watching this video, you will be able
to create an application using Express, and identify the five steps to install Express. Follow these five steps to work with
Express One, declare Express as a dependency in the
package manifest of your Node.js project. Two, run the npm command to download any missing
modules. Three, import the Express module and create
an Express application. Four, create a new route handler and five, start a Hypertext Transfer Protocol
(HTTP) server on a given port number. When you declare Express as a dependency in
your Node.js project and download any missing modules, you can create a mynodeserver.js
file in your project folder. Now you can start coding with your first Express
program. In this example, you are writing a program
to retrieve current weather conditions. When you have imported a copy of the Express
web application framework, create an instance of the app JavaScript object from the framework. Next, create a new route handler. In your application, to handle web application
requests, map an HTTP method and a web resource path to the JavaScript function. Here, you are listening to incoming HTTP GET
requests, which make requests to the temperature resource path. You are also saving the value after the temperature
resource path in a variable named location_code. You can access the variable in the path by
using request.params.location_code, and store the value in a location variable named “location.” When you run the weather.current function,
you pass the parameter location, which is taken from the resource path. In the last step, you start an HTTP server
on a given port number. To create an instance of the server from the
app, call app.listen to create a web server object (that is, an instance) that listens
to incoming requests on the specified port. The app listens to incoming requests; for
example, on port 8080. The second parameter defines an anonymous
function that the Express framework calls when it creates an instance of the server
object. For the result, enter the uniform resource
locator (URL) in your browser. In this video, you learned that: When you declare Express as a dependency in
your Node.js project and download any missing modules, you can create an application and
start coding with Express and to install Express, there are five steps: One, declare Express as a dependency in the
package manifest of a Node.js project. Two, run the npm command to download any missing
modules. Three, import the Express module and create
an Express application. Four, create a new route handler, and five, Start an HTTP server on a given port
number.